import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)
import config from "@/config";
export default new Vuex.Store({
    state: {
        nickname: ""
    },
    getters:{
        nickname(state){
            return state.nickname || sessionStorage.getItem(config.KEY.CACHE_LOGIN_USER);
        }
    },
    mutations: {
        setNickname(state, val) {
            state.nickname = val
            sessionStorage.setItem(config.KEY.CACHE_LOGIN_USER, val);
        }
    }
})